module.exports = function (gulp, plugins, options) {
    return function (done) {
        gulp.src(['./src/static/scripts/**/*.js', '!./src/static/scripts/public/**/*.js'])
            .pipe(plugins.plumber())
            // .pipe(plugins.sourcemaps.init())
            // .pipe(plugins.jshint())
            // .pipe(plugins.jshint.reporter('default'))
            // .pipe(plugins.changed('./dist/static/scripts'))
            .pipe(plugins.babel({
                presets: ['env']
            }))
            .pipe(plugins.if(options.env === 'prod', plugins.uglify()))
            .pipe(
                plugins.preprocess({
                    context: options.config[options.env].data
                })
            )
            // .pipe(plugins.sourcemaps.write('.'))
            .pipe(plugins.rev())
            .pipe(gulp.dest("dist/static/scripts"))
            .pipe(plugins.rev.manifest())
            .pipe(gulp.dest("dist/rev/scripts")).on('end', () => {
                done();
            });
    };
};